package com.zhixianggou.caibaobox.lottery.dataShow;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhixianggou.caibaobox.commons.result.ReturnData;
import com.zhixianggou.caibaobox.lottery.dataCollect.cover.SLotteryCover;
import com.zhixianggou.caibaobox.lottery.dataCollect.dao.SArray3Mapper;
import com.zhixianggou.caibaobox.lottery.dataCollect.dao.SArray5Mapper;
import com.zhixianggou.caibaobox.lottery.dataCollect.dao.SDaLeTouMapper;
import com.zhixianggou.caibaobox.lottery.dataCollect.dao.SSevenStarMapper;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SArray3;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SArray5;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SDaLeTou;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SSevenStar;
import com.zhixianggou.caibaobox.lottery.dataShow.sco.SLotteryDateSco;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zyq
 * 8/25/24 1:40 PM
 */
@Service
public class SLotteryService {

    @Resource
    SDaLeTouMapper sDaLeTouMapper;

    @Resource
    SArray3Mapper sArray3Mapper;

    @Resource
    SArray5Mapper sArray5Mapper;

    @Resource
    SSevenStarMapper sSevenStarMapper;

    /**
     * 体彩 大乐透列表
     * @return
     */
    public ReturnData sDaLeTouList(SLotteryDateSco sco){
        PageHelper.startPage(sco.getPageNum(),sco.getPageSize());
        List<SDaLeTou> sDaLeTous = sDaLeTouMapper.selectListBySco(sco);
        PageInfo pageInfo = new PageInfo<>(sDaLeTous);
        pageInfo.setList(SLotteryCover.INSTANCE.daLeTou2Vo(pageInfo.getList()));
        return  ReturnData.success(pageInfo);
    }
    /**
     * 体彩 排列3列表
     * @return
     */
    public ReturnData array3List(SLotteryDateSco sco) {
        PageHelper.startPage(sco.getPageNum(),sco.getPageSize());
        List<SArray3> sArray3s = sArray3Mapper.selectListBySco(sco);
        PageInfo pageInfo = new PageInfo<>(sArray3s);
        pageInfo.setList(SLotteryCover.INSTANCE.array32Vo(pageInfo.getList()));
        return ReturnData.success(pageInfo);
    }
    /**
     * 体彩 排列5列表
     * @return
     */
    public ReturnData array5List(SLotteryDateSco sco) {
        PageHelper.startPage(sco.getPageNum(),sco.getPageSize());
        List<SArray5> sArray5s = sArray5Mapper.selectListBySco(sco);
        PageInfo pageInfo = new PageInfo<>(sArray5s);
        pageInfo.setList(SLotteryCover.INSTANCE.array52Vo(pageInfo.getList()));
        return ReturnData.success(pageInfo);
    }
    /**
     * 体彩 七星彩列表
     * @return
     */
    public ReturnData sevenStarList(SLotteryDateSco sco) {
        PageHelper.startPage(sco.getPageNum(),sco.getPageSize());
        List<SSevenStar> sSevenStar = sSevenStarMapper.selectListBySco(sco);
        PageInfo pageInfo = new PageInfo<>(sSevenStar);
        pageInfo.setList(SLotteryCover.INSTANCE.sevenStar2Vo(pageInfo.getList()));
        return ReturnData.success(pageInfo);
    }
}
